/*
 Navicat Premium Data Transfer

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 50730 (5.7.30)
 Source Host           : localhost:3306
 Source Schema         : ordering_food

 Target Server Type    : MySQL
 Target Server Version : 50730 (5.7.30)
 File Encoding         : 65001

 Date: 09/12/2023 00:23:26
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for food
-- ----------------------------
DROP TABLE IF EXISTS `food`;
CREATE TABLE `food` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL COMMENT '菜名',
  `price` decimal(10,2) DEFAULT NULL COMMENT '单价',
  `info` varchar(2000) DEFAULT NULL COMMENT '描述',
  `category` int(11) DEFAULT NULL COMMENT '菜品类别',
  `hot` tinyint(1) DEFAULT NULL COMMENT '是否热销',
  `enable` tinyint(1) DEFAULT NULL COMMENT '上下架',
  `delete` tinyint(1) DEFAULT NULL COMMENT '删除状态',
  `create_time` datetime DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜品表';

-- ----------------------------
-- Records of food
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for food_category
-- ----------------------------
DROP TABLE IF EXISTS `food_category`;
CREATE TABLE `food_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) NOT NULL DEFAULT '0' COMMENT '父菜类id',
  `category_name` varchar(255) DEFAULT NULL COMMENT '菜类名称',
  `sort` int(11) DEFAULT NULL COMMENT '排序',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `upate_time` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COMMENT='菜品类别表';

-- ----------------------------
-- Records of food_category
-- ----------------------------
BEGIN;
INSERT INTO `food_category` (`id`, `parent_id`, `category_name`, `sort`, `create_time`, `upate_time`) VALUES (3, 0, '苹果', 1, '2023-12-09 00:06:41', '2023-12-09 00:07:41');
INSERT INTO `food_category` (`id`, `parent_id`, `category_name`, `sort`, `create_time`, `upate_time`) VALUES (4, 0, '芒果', 3, '2023-12-09 00:06:55', '2023-12-09 00:06:55');
COMMIT;

-- ----------------------------
-- Table structure for order
-- ----------------------------
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sn` varchar(255) DEFAULT NULL COMMENT '订单编号',
  `table_no` int(11) DEFAULT NULL COMMENT '桌号',
  `status` int(11) DEFAULT NULL COMMENT '订单状态 1：新订单 2：已完成',
  `amount` decimal(10,2) DEFAULT NULL COMMENT '订单总价',
  `create_time` datetime DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  `pay_time` datetime DEFAULT NULL COMMENT '支付时间',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单表';

-- ----------------------------
-- Records of order
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for order_item
-- ----------------------------
DROP TABLE IF EXISTS `order_item`;
CREATE TABLE `order_item` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order_id` int(11) DEFAULT NULL COMMENT '订单id',
  `food_id` int(11) DEFAULT NULL COMMENT '菜品id',
  `num` int(11) DEFAULT NULL COMMENT '数量',
  `price` decimal(10,2) DEFAULT NULL COMMENT '单价',
  `amount` decimal(10,2) DEFAULT NULL COMMENT '总价',
  `create_time` datetime DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单item表';

-- ----------------------------
-- Records of order_item
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(255) DEFAULT NULL COMMENT '用户名',
  `password` varchar(255) DEFAULT NULL COMMENT '密码',
  `state` tinyint(4) DEFAULT NULL COMMENT '1：启用 0：禁用',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='用户表';

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` (`id`, `username`, `password`, `state`, `create_time`, `update_time`) VALUES (1, 'admin', 'admin', 1, '2023-12-08 22:01:57', '2023-12-08 22:02:00');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
